<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>选项卡功能</title>
</head>
<style>
    ul,li{
        margin: 0;
        padding: 0;
        list-style: none;
}
    ul{
        overflow: hidden;
    }
    li{
        width: 100px;
        height: 40px;
        background-color: rgb(246, 95, 2);
        border: 1px solid #07d533;
        float: left;
        line-height: 40px;
        text-align: center;
    }
    div{
        width: 406px;
        height: 406px;
         border: 1px solid #ccc;

    }

    img{
        width: 406px;
        height: 406px;
        display: none;
    }
</style>
<body>
    <ul>
        <li>大橘</li>
        <li>英短</li>
        <li>美短</li>
        <li>布偶</li>
    </ul>
    <div>
        <img src="./imgs/1.jpg" alt="" style="display: block;">
        <img src="./imgs/2.jpg" alt="" >
        <img src="./imgs/3.jpg" alt="" >
        <img src="./imgs/4.jpg" alt="" >


    </div>
    <script>
      let li =   document.getElementsByTagName('li');
      let img = document.getElementsByTagName('img');

            
        for (let i = 0; i < li.length; i++) {
            li[i].index = i;
           li[i].onmouseover = function() {
            li[i].style.backgroundColor = 'green';
                for (let j = 0; j < img.length; j++) {
                    img[j].style.display = 'none';
                  
                }
            img[this.index].style.display = 'block';

           }
           li[i].onmouseout = function(){
              li[i].style.backgroundColor = '#eee';


           }
            
        }

    </script>
    
</body>
</html>